#include <iostream>
#include <string>
using namespace std;

//定义学生的结构体
struct student
{
    string name;
    int age;
    int score;
};

//1.值传递
void printStu1(student s){
    // s.age = 100;
    cout << "子1函数中" << s.name << s.age << s.score << endl;
}

//2.地址传递
void printStu2(student* s){
    s->age = 200;
    cout << "子2函数中" << s->name << s->age << s->score << endl;
}

int main(){
    
    // struct Student s1;
    student s1;
    
    //给s1属性赋值,通过.访问结构体变量中的属性
    s1.name = "张三";
    s1.age = 19;
    s1.score = 80;
    // cout << s1.age << s1.name << s1.score << endl;
    printStu1(s1);
    printStu2(&s1);
    
	system("pause");
	return 0;
}

